package com.gxa.service.impl.fwgl.hlgl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gxa.mapper.fwgl.hlgl.ServiceMapper;
import com.gxa.mapper.fwgl.yhgl.CheckInMapper;
import com.gxa.pojo.dto.fwgl.NormalInDto;
import com.gxa.pojo.entity.fwgl.TCheckIn;
import com.gxa.pojo.entity.fwgl.TServicemanage;
import com.gxa.service.fwgl.hlgl.ServMService;
import com.gxa.utils.QueryResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：lizhijun
 * @Package：{PROJECT_NAME}
 * @name：{DATE} {NAME}
 */
@Service
public class ServMServiceImpl implements ServMService {

    @Resource
    private ServiceMapper serviceMapper;
    @Override
    public QueryResult queryAll(NormalInDto normalInDto) {
        Page<TServicemanage> page = PageHelper.startPage(normalInDto.getPage(),normalInDto.getLimit());
        List<TServicemanage> servicemanageList = serviceMapper.queryAll(normalInDto);
        QueryResult queryResult = new QueryResult();
        queryResult.setCount(page.getTotal());
        queryResult.setData(servicemanageList);
        return queryResult;
    }

    @Override
    public void add(TServicemanage servicemanage) {
    serviceMapper.insertService(servicemanage);
    }

    @Override
    public void update(TServicemanage servicemanage) {
        serviceMapper.updateService(servicemanage);
    }

    @Override
    public void delete(int id) {
        serviceMapper.deleteService(id);
    }
}
